package com.neutech.maplestory.util;

import com.neutech.maplestory.constant.Constant;

import java.awt.*;
import java.util.HashMap;
import java.util.Map;

/**
 * 静态加载项目中的所有图片
 * 就是为了把图片放进来，需要GameUtil来加载图片在放到map集合中
 */
public class ImageUtil {
    public static Map<String, Image> imageMap = new HashMap<>();

    static {
        /**
         * 添加logo
         */
        imageMap.put("logo", GameUtil.getImage("logo/logo"));
        /**
         * 添加背景图
         */
        imageMap.put("background_map",GameUtil.getImage("background/background_map"));
        /**
         * 添加英雄右面站着的
         */
        for (int i = 0; i < 4; i++) {
            imageMap.put("hero_right_stand" + i, GameUtil.getImage("hero/right/stand/stand1_" + i));
        }
        /**
         * 添加任务右面站着的
         */
        for (int i = 0; i < 4; i++) {
            imageMap.put("hero_left_stand" + i, GameUtil.getImage("hero/left/stand/stand1_" + i));
        }
        /**
         * 添加任务右面走
         */
        for (int i = 0; i < 5; i++) {
            imageMap.put("hero_right_walk" + i, GameUtil.getImage("hero/right/walk/walk1_" + i));
        }
        /**
         * 添加人物左面走
         */
        for (int i = 0; i < 5; i++) {
            imageMap.put("hero_left_walk" + i, GameUtil.getImage("hero/left/walk/walk1_" + i));
        }
        /**
         * 添加人物右面趴着
         */
        imageMap.put("hero_right_prone", GameUtil.getImage("hero/right/prone/prone_0"));
        /**
         * 添加人物左面趴着
         */
        imageMap.put("hero_left_prone", GameUtil.getImage("hero/left/prone/prone_0"));
        /***
         * 添加人物右面跳
         */
        imageMap.put("hero_right_jump", GameUtil.getImage("hero/right/jump/jump_0"));
        /**
         * 添加人物左面跳
         */
        imageMap.put("hero_left_jump", GameUtil.getImage("hero/left/jump/jump_0"));
        /**
         * 添加人物右面射击
         */
        for (int i = 0; i < 4; i++) {
            imageMap.put("hero_right_shoot" + i, GameUtil.getImage("hero/right/shoot/shoot1_" + i));
        }
        /**
         * 添加人物左面的射击
         */
        for (int i = 0; i < 4; i++) {
            imageMap.put("hero_left_shoot" + i, GameUtil.getImage("hero/left/shoot/shoot1_" + i));
        }
        /**
         * 添加人物右面的飞
         */
        for (int i = 0; i < 3; i++) {
            imageMap.put("hero_right_fly" + i, GameUtil.getImage("hero/right/fly/fly_" + i));
        }
        /**
         * 添加人物左面飞
         */
        for (int i = 0; i < 3; i++) {
            imageMap.put("hero_left_fly" + i, GameUtil.getImage("hero/left/fly/fly_" + i));
        }
        /**
         * 添加右面的弓箭
         */
        imageMap.put("hero_right_arrow", GameUtil.getImage("arrow/right/hero_right_arrow"));
        /**
         * 添加左面的弓箭
         */
        imageMap.put("hero_left_arrow", GameUtil.getImage("arrow/left/hero_left_arrow"));
        /**
         * 怪物左面站着的图片
         */
        for (int i = 0; i < 3; i++) {
            imageMap.put("mob_left_stand" + i, GameUtil.getImage("mob/mob01/left/stand/stand_" + i));
        }
        /**
         * 怪物右面站着的图片
         */
        for (int i = 0; i < 3; i++) {
            imageMap.put("mob_right_stand" + i, GameUtil.getImage("mob/mob01/right/stand/stand_" + i));
        }

        /**
         * 怪物左面走的图片
         */
        for (int i = 0; i < 4; i++) {
            imageMap.put("mob_left_walk" + i, GameUtil.getImage("mob/mob01/left/walk/move_" + i));
        }
        /**
         * 怪物右面走的图片
         */
        for (int i = 0; i < 4; i++) {
            imageMap.put("mob_right_walk" + i, GameUtil.getImage("mob/mob01/right/walk/move_" + i));
        }
        /**
         * 怪物左面跳的图片
         */
        imageMap.put("mob_left_jump", GameUtil.getImage("mob/mob01/left/jump/jump_0"));
        /**
         * 怪物右面跳的图片
         */
        imageMap.put("mob_right_jump", GameUtil.getImage("mob/mob01/right/jump/jump_0"));
        /**
         * 怪物左面死的图片
         */
        for (int i = 0; i < 3; i++) {
            imageMap.put("mob_left_die" + i, GameUtil.getImage("mob/mob01/left/die/die1_" + i));
        }
        /**
         * 怪物右面死的图片
         */
        for (int i = 0; i < 3; i++) {
            imageMap.put("mob_right_die" + i, GameUtil.getImage("mob/mob01/right/die/die1_" + i));
        }
        /**
         * boss左面的站着
         */
        for (int i = 0; i <8 ; i++) {
            imageMap.put("boss_left_stand0" + i,GameUtil.getImage("boss/stand/left/stand0" + i));
        }
        /**
         * boss右面站着
         */
        for (int i = 0; i <8 ; i++) {
            imageMap.put("boss_right_stand0" + i,GameUtil.getImage("boss/stand/right/stand0" + i));
        }


        /**
         * boss左面攻击
         */
        for (int i = 0; i <20 ; i++) {
            imageMap.put("boss_left_attack" + i,GameUtil.getImage("boss/attack/left/attack" + i));
        }
        /**
         * boss右面攻击
         */
        for (int i = 0; i <20 ; i++) {
            imageMap.put("boss_right_attack" + i,GameUtil.getImage("boss/attack/right/attack" + i));
        }
        /**
         * boss左面走的
         */
        for (int i = 0; i <8 ; i++) {
            imageMap.put("boss_left_walk0" + i,GameUtil.getImage("boss/walk/left/walk0" + i));
        }
        /**
         * boss右面走
         */
        for (int i = 0; i <8 ; i++) {
            imageMap.put("boss_right_walk0" + i,GameUtil.getImage("boss/walk/right/walk0" + i));
        }
        /**
         * boss左面攻击的技能
         */
        for (int i = 0; i <8 ; i++) {
            imageMap.put("boss_left_skill0" + i,GameUtil.getImage("boss/skill/left/skill0" + i));
        }
        /**
         * boss右面攻击的技能
         */
        for (int i = 0; i <8 ; i++) {
            imageMap.put("boss_right_skill0" + i,GameUtil.getImage("boss/skill/right/skill0" + i));
        }
        /**
         * boss左面死
         */
        for (int i = 0; i <29 ; i++) {
            imageMap.put("boss_left_die" + i,GameUtil.getImage("boss/die/left/die" + i));
        }
        /**
         * boss右面死
         */
        for (int i = 0; i <29 ; i++) {
            imageMap.put("boss_right_die" + i,GameUtil.getImage("boss/die/right/die" + i));
        }
        /**
         * 怪物右面死
         */
        for (int i = 0; i <29 ; i++) {
            imageMap.put("boss_right_die" + i,GameUtil.getImage("boss/die/right/die" + i));
        }
        /**
         * 云彩
         */
        for (int i = 0; i <6 ; i++) {
            imageMap.put("sky" + i,GameUtil.getImage("cloud/sky" + 0));
        }

        /**
         * 怪物的血条
         */
        imageMap.put("mob_left_blood", GameUtil.getImage("mob/mob01/left/blood/blood"));
        /**
         * 道具的图片
         */
        imageMap.put("HP_100", GameUtil.getImage("item/HP_100"));
        imageMap.put("HP_300", GameUtil.getImage("item/HP_300"));
        imageMap.put("MP_100", GameUtil.getImage("item/MP_100"));
        imageMap.put("MP_300", GameUtil.getImage("item/MP_300"));
        imageMap.put("AT_300", GameUtil.getImage("item/AT_300"));
        imageMap.put("AT_500", GameUtil.getImage("item/AT_500"));
        /**
         * 人物爬的照片
         */
        imageMap.put("climb0",GameUtil.getImage("hero/climb/climb0"));
        imageMap.put("climb1",GameUtil.getImage("hero/climb/climb1"));
        /**
         * 工具包的图片
         */
        imageMap.put("hero_item_package", GameUtil.getImage("hero/package/ItemPackage"));
        for (int i = 0; i < 10; i++) {
            imageMap.put("power" + i, GameUtil.getImage("power/" + i));
        }


    }

    private ImageUtil() {
    }

    /**
     * 通过键来调用图片
     *
     * @param key key图片的键
     * @return 返回图片的键
     */
    public static Image getImage(String key) {
        return imageMap.get(key);
    }
}
